import java.util.HashMap;

/**
 * @author Bachelor
 * 测试 SelectionSort类
 */
public class Student implements Comparable<Student>{
    private String name;
    private int socre;

    public Student(String name, int socre) {
        this.name = name;
        this.socre = socre;
    }

    @Override
    public int compareTo(Student another) {
        // if (this.socre < another.socre) {
        //     return -1;
        // } else if (this.socre == another.socre) {
        //     return 0;
        // } else {
        //     return 1;
        // }
        return this.socre - another.socre;
    }

    @Override
    public boolean equals(Object student) {
        if (this == student) {
            return true;
        }
        if (student == null) {
            return false;
        }
        if (this.getClass() != student.getClass()) {
            return false;
        }
        Student another = (Student) student;
        return this.name.equals(another.name);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Student{");
        sb.append("name='").append(name).append('\'');
        sb.append(", socre=").append(socre);
        sb.append('}');
        return sb.toString();
    }
}
